<template>
	 <el-tabs type="border-card">
    
	<el-tab-pane label="司机统计">
    <el-date-picker
      v-model="value2"
      type="month"
	   format="yyyy 年 MM 月 "
      value-format="yyyy-MM"
      placeholder="选择月">
    </el-date-picker>
   <el-button  @click="getDriverList">确定</el-button>
     <el-table
      :data="arr"
      style="width: 100%">
      <el-table-column
        prop="name"
        label="姓名"
        width="180">
      </el-table-column>
      <el-table-column
        prop="taskName"
        label="任务名称"
        width="180">
      </el-table-column>
      <el-table-column
        prop="total"
        label="任务次(天)数">
      </el-table-column>
	  <el-table-column
        prop="countKms"
        label="里程统计">
      </el-table-column>
	  <el-table-column
        prop="cartMoneyCount"
        label="车辆收费统计">
      </el-table-column>
	  <el-table-column
        prop="totalPrice"
        label="差费统计">
      </el-table-column>
	   <el-table-column
        label="备注">
      </el-table-column>
    </el-table>
	</el-tab-pane>
	<el-tab-pane label="车辆统计">
    <el-date-picker
      v-model="value3"
      type="month"
	   format="yyyy 年 MM 月 "
      value-format="yyyy-MM"
      placeholder="选择月">
    </el-date-picker>
   <el-button  @click="getCarsList">确定</el-button>
    <el-table
      :data="arr1"
      style="width: 100%">
      <el-table-column
        prop="name"
        label="车辆牌号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="taskName"
        label="任务名称"
        width="180">
      </el-table-column>
      <el-table-column
        prop="total"
        label="任务次(天)数">
      </el-table-column>
	  <el-table-column
        prop="countKms"
        label="里程统计">
      </el-table-column>
	  <el-table-column
        prop="cartMoneyCount"
        label="车辆收费统计">
      </el-table-column>
	   <el-table-column
        label="备注">
      </el-table-column>
    </el-table>
  </el-tab-pane>
	<el-tab-pane label="部门统计">
       <el-date-picker
      v-model="value4"
      type="month"
	   format="yyyy 年 MM 月 "
      value-format="yyyy-MM"
      placeholder="选择月">
    </el-date-picker>
   <el-button  @click="getPartmentList">确定</el-button>
       <el-table
      :data="arr4"
      style="width: 100%">
      <el-table-column
        prop="name"
        label="部门"
        width="180">
      </el-table-column>
      <el-table-column
        prop="taskName"
        label="任务名称"
        width="180">
      </el-table-column>
      <el-table-column
        prop="total"
        label="任务次(天)数">
      </el-table-column>
	  <el-table-column
        prop="countKms"
        label="里程统计">
      </el-table-column>
	  <el-table-column
        prop="cartMoneyCount"
        label="车辆收费统计">
      </el-table-column>
      <el-table-column
        prop="totalPrice"
        label="合计金额">
      </el-table-column>
	   <el-table-column
        label="备注">
      </el-table-column>
    </el-table>
  </el-tab-pane>
	</el-tabs>
</template>

<script>
import request from '../api/request.js'
export default {
    data(){
      return{
      value2: '',
      value3:'',
			driverList:[],
      arr:[],
      arr1:[],
      arr4:[],
      value4:''
        }
    },
    created(){
      },
    methods: {
	   //获取司机数据
	   getDriverList(){
		   var that = this
		   var value2 =  that.value2
		   console.log(value2)
		   request({
			   url:'/order/getDriverStatistics',
			   method:'POST',
			   data:{
                   date:value2
			   }
		   }).then(res=>{
			 this.driverList = res.data
      var arr=[]
		    for(var i=0;i<this.driverList.length;i++){
				for(let n in this.driverList[i]){
        this.list1 = this.driverList[i][n]
        this.arr = this.arr.concat(this.list1)
        console.log(this.arr)
				}
				}
		   }).catch(err => {
			   console.log(err)
		   })
     },
     //获取车辆信息
     getCarsList(){
       var that = this
       var value3 =  that.value3
       console.log(value3)
       request({
         url:'/order/getCarStatistics',
          method:'POST',
			   data:{
                   date:value3
			   }
       }).then(res=>{
         console.log(res.data)
         this.carList = res.data
         var arr1 =[]
         for(let i =0 ;i<this.carList.length;i++){
           for(let n in this.carList[i]){
             this.list = this.carList[i][n]
             this.arr1 = this.arr1.concat(this.list)
             console.log(this.arr1)
           }
         }
       }).catch(err => {
         console.log(err)
       })
     },
     //获取部门信息
     getPartmentList(){
       var that = this
       var value4=  that.value4
       request({
         url:'/order/getPartmentStatistics',
          method:'POST',
			   data:{
             date:value4
			   }
       }).then(res => {
         console.log(res.data)
         this.partmentList = res.data
         var arr4=[]
         for(let i=0;i< this.partmentList.length;i++){
           for(let n in  this.partmentList[i]){
             this.list4 =  this.partmentList[i][n]
             this.arr4 = this.arr4.concat(this.list4)
             console.log(this.arr4)
           }
         }
       }).catch(err => {
         console.log(err)
       })
     }
    }
}
</script>